package xyz.hzxiao.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.hzxiao.entity.UserEntity;
import xyz.hzxiao.service.UserService;

import javax.annotation.Resource;

/**
 * 字段加解密控制器
 *
 * @author ：FuXx
 * @className : xyz.hzxiao.controller.UserController
 * @since ：2023-08-18
 */
@RestController
public class EncryptedController {

    @Resource(name = "userServiceImpl")
    private UserService currentService;

    @GetMapping("/add")
    public String add(UserEntity entity) {
        currentService.save(entity);
        return "ok";
    }

    @GetMapping("/get")
    public String get(Integer id) {
        return currentService.getById(id).toString();
    }

    @GetMapping("/update")
    public String update(UserEntity entity) {
        currentService.updateById(entity);
        return "ok";
    }
}
